| Disk ARchive 2.8.1 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
escape_catalogue.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
33
34#ifndef ESCAPE_CATALOGUE_HPP
35#define ESCAPE_CATALOGUE_HPP
36
37#include "../my_config.h"
38
39#include "catalogue.hpp"
40#include "escape.hpp"
41#include "pile_descriptor.hpp"
42#include "smart_pointer.hpp"
43#include "header_version.hpp"
44
45 namespace libdar
46{
47
50
51 class escape_catalogue : public catalogue
52 {
53 public:
54
56 escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
57 const pile_descriptor & x_pdesc,
58 const datetime & root_last_modif,
59 const label & data_name);
60
62 escape_catalogue(const std::shared_ptr<user_interaction> & dialog,
63 const pile_descriptor & x_pdesc,
64 const header_version & ver,
65 const std::list<signator> & known_signatories,
66 bool lax = false
67 );
68 escape_catalogue(const escape_catalogue & ref) : catalogue(ref) { copy_from(ref); };
69 escape_catalogue(escape_catalogue && ref) = delete;
70 escape_catalogue & operator = (const escape_catalogue &ref);
71 escape_catalogue & operator = (escape_catalogue && ref) = delete;
72 ~escape_catalogue() { destroy(); };
73
74 // inherited from catalogue
75 virtual void pre_add(const cat_entree *ref, const pile_descriptor* dest) const override;
76 virtual void pre_add_ea(const cat_entree *ref, const pile_descriptor* dest) const override;
77 virtual void pre_add_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
78 virtual void pre_add_dirty(const pile_descriptor* dest) const override;
79 virtual void pre_add_ea_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
80 virtual void pre_add_waste_mark(const pile_descriptor* dest) const override;
81 virtual void pre_add_failed_mark(const pile_descriptor* dest) const override;
82 virtual void pre_add_fsa(const cat_entree *ref, const pile_descriptor* dest) const override;
83 virtual void pre_add_fsa_crc(const cat_entree *ref, const pile_descriptor* dest) const override;
84 virtual void pre_add_delta_sig(const pile_descriptor* dest) const override;
85 virtual escape *get_escape_layer() const override { return pdesc.is_null() ? nullptr : pdesc->esc; };
86 virtual void drop_escape_layer() override { pdesc.assign(nullptr); };
87 virtual void set_escape_layer(escape* ptr) override { throw SRC_BUG; };
88
89 virtual void reset_read() const override;
90 virtual void end_read() const override;
91 virtual void skip_read_to_parent_dir() const override;
92 virtual bool read(const cat_entree * & ref) const override;
93 virtual bool read_if_present(std::string *name, const cat_nomme * & ref) const override;
94 virtual void remove_last_read() override;
95 virtual void tail_catalogue_to_current_read(bool including_last_read) override;
96 virtual bool read_second_time_dir() const override { return status == ec_detruits; };
97 virtual void set_in_place(const path & arg) override;
98 virtual void clear_in_place() override;
99
100
101 private:
102 enum state
103 {
104 ec_init,
105 ec_marks,
106 ec_eod,
107 ec_signature,
108 ec_detruits,
109 ec_completed
110 };
111
112 smart_pointer<pile_descriptor> pdesc;
113 header_version x_ver;
114 std::list<signator> known_sig;
115 bool x_lax;
116 std::map <infinint, cat_etoile *> corres;
117 state status;
118 std::string last_added_name;
119 catalogue *cat_det;
120 infinint min_read_offset;
121 infinint depth;
122 infinint wait_parent_depth;
123
124 void set_esc_and_stack(const pile_descriptor & x_pdesc);
125 void copy_from(const escape_catalogue & ref);
126 void destroy();
127 void merge_cat_det();
128 void reset_reading_process();
129 };
130
132
133} // end of namespace
134
135#endif
catalogue.hpp
here is defined the classe used to manage catalogue of archives
libdar::smart_pointer::is_null
bool is_null() const
return whether the smart_pointer is pointing to nullptr
Definition smart_pointer.hpp:165
libdar::smart_pointer::assign
const smart_pointer & assign(T *arg)
assignment operator from a base type pointer (not from a smart_pointer)
Definition smart_pointer.hpp:151
escape.hpp
class escape definition, used for sequential reading of archives
header_version.hpp
archive global header/trailer structure is defined here
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
pile_descriptor.hpp
optimization structure to quickly access some commonly used layers of a stack of generic_file
smart_pointer.hpp
template class implementing memory efficient smart pointer